package test;

import entity.Course;
import entity.Student;
import entity.Teacher;

public class TestMain {
    public static void main(String[] args) {
        // 1. 创建一门课程
        Course math = new Course("C001", "高等数学", "第一教学楼302", "周一上午9:00-11:00");

        // 2. 创建一位老师并分配课程
        Teacher liTeacher = new Teacher("T001", "李老师", "男");
        liTeacher.setTaughtCourse(math);
        System.out.println(liTeacher.getTeacherName() + " 开设了课程：" + liTeacher.getTaughtCourse().getCourseName());

        // 3. 创建一位学生并进行选课、退课操作
        Student zhangStudent = new Student("S001", "张三", "男");
        zhangStudent.selectCourse(math); // 选课
        System.out.println(zhangStudent.getStudentName() + " 选了课程：" + zhangStudent.getSelectedCourse().getCourseName());

        zhangStudent.dropCourse(); // 退课
        System.out.println(zhangStudent.getStudentName() + " 已退课");

        zhangStudent.selectCourse(math); // 再次选课

        // 4. 打印学生的课表
        System.out.println("\n" + zhangStudent.getStudentName() + " 的课表：");
        Course selected = zhangStudent.getSelectedCourse();
        if (selected != null) {
            System.out.println("课程名称：" + selected.getCourseName());
            System.out.println("课程编号：" + selected.getCourseId());
            System.out.println("上课时间：" + selected.getTime());
            System.out.println("上课地点：" + selected.getLocation());
            System.out.println("授课老师：" + liTeacher.getTeacherName());
        } else {
            System.out.println("暂无选课记录");
        }
    }
}